package com.situ.day24;

import com.situ.day23.Student;
import com.situ.day23.Teacher;
import org.junit.Test;

import java.util.ArrayList;
import java.util.List;

public class GenericDemo2 {
    public Student add(Student student, Teacher teacher) {
        return student;
    }

    public <K,T> K add(K k, T t) {
        return k;
    }

    @Test
    public void test1() {
        Float result1 = add(1.0f, 1);
        System.out.println(result1);
        String result2 = add("abc", 123);
        System.out.println(result2);
    }

    @Test
    public void test2() {
        Student student = new Student();
        BaseDao<Student> baseDao1 = new BaseDao<>();
        baseDao1.add(student);
        baseDao1.update(student);

        Teacher teacher = new Teacher();
        BaseDao<Teacher> baseDao2 = new BaseDao<>();
        baseDao2.add(teacher);
    }

    public void add1(List<?> list) {
        //list.add(12);
    }

    public void add(List<? extends Number> list) {
    }

    @Test
    public void test56() {
        List<Double> list1 = new ArrayList<>();
        List<Float> list2 = new ArrayList<>();
        List<Integer> list3 = new ArrayList<>();
        List<String> list4 = new ArrayList<>();
        add(list1);
        add(list2);
        add(list3);
        //add(list4);
    }
}
